package com.qfedu.cart.service.impl;

import com.qfedu.cart.mapper.ShoppingMapper;
import com.qfedu.cart.po.Shoppingcar;
import com.qfedu.cart.service.IShoppingService;
import com.qfedu.cart.vo.JsonResultVO;
import com.qfedu.cart.vo.MerchantInfo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class ShoppingServiceImpl implements IShoppingService {
    @Resource
    private ShoppingMapper shoppingMapper;

    @RequestMapping(value = "add",method = RequestMethod.POST)
    @Override
    public JsonResultVO addShopping(@RequestBody Shoppingcar shoppingcar) throws Exception {
        shoppingMapper.addShopping(shoppingcar);
        JsonResultVO jsonResultVO = new JsonResultVO();
        jsonResultVO.setCode(1);
        return jsonResultVO;
    }

    @RequestMapping(value = "list",method = RequestMethod.GET)
    @Override
    public List<MerchantInfo> queryShoppingList() {
        return shoppingMapper.queryShoppingList();
    }
}
